<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css"
	href="/js/jquery-easyui-1.4.1/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css"
	href="/js/jquery-easyui-1.4.1/themes/icon.css" />
<script type="text/javascript"
	src="/js/jquery-easyui-1.4.1/jquery.min.js"></script>
<script type="text/javascript"
	src="/js/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="/js/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<title>考勤信息列表</title>
<style type="text/css">
.searchbox {
	margin: -3
}
</style>

<script type="text/javascript">
	$(function() {
		$('#dg').datagrid({
			url : '/check/list',
			fitColumns : true,
			autoRowHeight : false,
			nowrap : true,
			idField : 'id',
			rownumbers : true,
			pagination : true,
			pageSize : 5,
			pageList : [ 3, 5, 10, 20 ],
			queryParams : {
				type : 'all'
			},
			toolbar : '#tb',
			columns : [ [ {
				checkbox : true,
				field : ""
			}, {
				field : 'id',
				title : '编号'
			}, {
				field : 'studentName',
				title : '学生名',
				width : 100
			}, {
				field : 'collegeName',
				title : '所在院系',
				width : 100
			}, {
				field : 'majorName',
				title : '所在专业',
				width : 100
			}, {
				field : 'className',
				title : '所在班级',
				width : 100
			}, {
				field : 'checkType',
				title : '签到状态',
				width : 100
			}, {
				field : 'checkTime',
				title : '签到时间',
				width : 100,
				formatter : face.formatDateTime
			}, {
				field : 'checkAddress',
				title : '签到状态',
				width : 100
			}, {
				field : 'checkYear',
				title : '签到年份',
				width : 100
			} ] ]

		});
		$('#ss').combobox({
			onChange : function(newValue, oldValue) {

				var rows = $('#dg').datagrid('getRows'), rst = [];
				for (var i = 0; i < rows.length; i++)
					if (rows[i].collegeName == newValue)
						rst.push(rows[i]);

				$('#dg').datagrid('loadData', rst);
				
				$.post("/student/data", {
					"name" : newValue
				}, function(data) {

					var dd = [];
					var d = eval(data);
					$.each(d, function(n, value) {
						dd.push({
							"text" : value.majorName,
							"id" : n,
							"value" : value.majorName
						});
					});

					$("#mm").combobox("loadData", dd);

				});

			}
		});

		$('#mm').combobox({
			onChange : function(newValue, oldValue) {

				var rows = $('#dg').datagrid('getRows'), rst = [];
				for (var i = 0; i < rows.length; i++)
					if (rows[i].majorName == newValue)
						rst.push(rows[i]);

				$('#dg').datagrid('loadData', rst);
				
				$.post("/student/classInfo", {
					"name" : newValue
				}, function(data) {

					var dd = [];
					var d = eval(data);
					$.each(d, function(n, value) {
						dd.push({
							"text" : value.className,
							"id" : n,
							"value" : value.className
						});
					});

					$("#cc").combobox("loadData", dd);

				});

			}
		});

		$('#cc').combobox({
			onChange : function(newValue, oldValue) {
				var rows = $('#dg').datagrid('getRows'), rst = [];
				for (var i = 0; i < rows.length; i++)
					if (rows[i].className == newValue)
						rst.push(rows[i]);

				$('#dg').datagrid('loadData', rst);
			}
		});

		$('#year').combobox({
			onChange : function(newValue, oldValue) {
				var rows = $('#dg').datagrid('getRows'), rst = [];
				for (var i = 0; i < rows.length; i++)
					if (rows[i].checkYear == newValue)
						rst.push(rows[i]);

				$('#dg').datagrid('loadData', rst);
			}
		});

	});
</script>
</head>

<body>
	<table id="dg"></table>
	<div id="tb" style="padding: 5px">

		<div>
			年份：<select id="year" name="checkYear" class="easyui-combobox"
				panelHeight="auto" style="width: 100px">
				<option value="2017">2017</option>
				<option value="2018">2018</option>
			</select> 院系： <select id="ss" name="type" class="easyui-combobox"
				panelHeight="auto" style="width: 100px">
				<option></option>

				<c:forEach items="${list}" var="college">
					<option value="${college.collegeName}">${college.collegeName}</option>
				</c:forEach>
			</select> 专业:<select id="mm" name="type" class="easyui-combobox"
				panelHeight="auto" style="width: 100px">
				<option></option>


			</select> 班级：<select id="cc" name="type" class="easyui-combobox"
				panelHeight="auto" style="width: 100px">
				<option></option>

			</select>
		</div>
	</div>
</body>
</html>